<div class="row fixed">
<h3>Blog</h3>
	<div class="col-220">
		<div class="hr-alt2"></div>
		<?php App::Hook('UI')->Render('template_left_column_A'); #User Interface Hook ?>
		<?php App::Hook('UI')->Render('template_left_column_B'); #User Interface Hook ?>
		<h4><?php echo $this->__('Categories');?></h4>
		<br />
		<?php
		//pr($rec_comm);
			App::Plugin("CatMultiLevelMenu_Generator")
			   ->setUrlPattern($this->baseurl("/blog-by-cat/[id]/[title]"))
			   ->setLinkToParent(true)
			   ->setSelected($catid)
			   ->setSelectedCSSClass('link-selected')
			   ->setType('blog-cat')
			   ->getRecursive();
		?>
		
		<br />
        <h4>Recent Comments</h4>
        <br />
        <?php if(!empty($rec_comm['data'])):?>
			<ul class="dropdown">
			  <?php foreach($rec_comm['data'] as $rec):?>
				<li>
					<span class="rec">
						<a href="<?php echo $this->baseurl("/blog-by-post/{$rec['postid']}/"); ?>#commvid" class="reclink">
							<?php echo($rec['comment']);?>
						</a> 
						by 
						<a href="mailto:<?php echo $rec['email'];?>" class="reclink"><?php echo $rec['name']; ?></a>
					</span>
				</li>
			  <?php endforeach;?>
			</ul>
		<?php else:?>
			<p><?php echo $this->__("No comment posted yet"); ?></p>
		<?php endif;?>
		
		<?php App::Hook('UI')->Render('template_left_column_C'); #User Interface Hook ?>
		<?php App::Hook('UI')->Render('template_left_column_D'); #User Interface Hook ?>
	</div>
	
	<div class="col-700 last">
		<div class="blog-post">
		<?php if($action == 'bypost'):?>
			
				<h3><a href="<?php echo $this->baseurl("/blog-by-post/{$post['id']}/" . App::Helper('Utility')->text2Normalize($post['title'])); ?>"><?php echo($post['title']);?></a></h3>
				<p>
					<?php $catname = App::CategorySet()->idToName($post['category']);?>
					<!--<a href="<?php echo $this->baseurl("/blog-by-cat/{$post['category']}/" . App::Helper('Utility')->text2Normalize($catname)); ?>"><?php echo $catname;?></a> |-->
					Posted by: <strong><?php echo App::Module('adminPanelUi')->adminName($post['adminref']);?></strong> | 
					Posted on: <strong><?php echo App::Helper('Date')->dateFormated($post['entry_date'],'long'); ?></strong> |
					<?php echo App::Model('Comment')->countByPostId($post['id']); echo $this->__(" Comments");?>
				</p>
				<?php App::Hook('UI')->Render('blog_before_post'); #User Interface Hook ?>
				<?php echo($post['description']);?>
				<?php App::Hook('UI')->Render('blog_after_post'); #User Interface Hook ?>
				<div class="hr"></div>
			
				<h4><?php echo $this->__("Comments");?></h4>
				<?php if(!empty($comments['data'])):?>
					
					<?php foreach($comments['data'] as $comment):?>
						<div class="comment" id="commvid">
							<p class="who">
								<strong><?php echo App::Helper('Html')->linkTag($comment['website'],$comment['name'],Array("rel"=>"nofollow")); ?></strong><br />
								<span class="date"><?php echo App::Helper('Date')->dateFormated($comment['dated'],'long'); ?></span>
							</p>
							<p><?php echo($comment['comment']);?></p>
						</div>
					<?php endforeach;?>
					
				<?php else:?>
					<p id="commvid"><?php echo $this->__("No comment posted yet"); ?></p>
				<?php endif;?>
				 <div class="hr"></div>
			
				<h4><?php echo $this->__('Leave a Comment');?></h4>
				
				<div class="message"></div>
				<form method="post" id="comment-form" action="<?php echo $this->baseurl("/appblog/submitcomment/{$post['id']}") ?>" class="form">
					<fieldset>
						<p>
							<label for="name"><?php echo $this->__('Your Name');?><span class="required">*</span></label><br />
							<input type="text" name="data[Comment][name]" class="input check_notdefault text" longdesc="Please enter your name." />
						</p>
						<p>
							<label><?php echo $this->__('Your Email Address');?><span class="required">*</span></label><br />
							<input type="text" name="data[Comment][email]" class="input check_email" longdesc="Please enter your valid email address."/>
						</p>
						<!--<li><label><?php echo $this->__('Website');?></label><span><input type="text" name="data[Comment][website]" class="input" value="Type website name" /></span></li>-->
						<p>
							<label><?php echo $this->__('Message');?></label><br />
							<textarea name="data[Comment][comment]" class="input check_notdefault" longdesc="Please type your comment here." rows="5"></textarea>
						</p>
						<p>
							<label><?php echo App::Helper('Html')->capachaTag("blogcommet",Array("bk_color"=>"#99011E","font_color"=>"#FFFFFF"));?></label><br />
							<input type="text" name="data[Comment][capacha]" class="input check_notempty" longdesc="Please fillin the text display left side image." value="" />
						</p>
						<p>
						<label>&nbsp;</label><span><input type="submit" value="Send" class="button" /></span>
						</p>
					</fieldset>
				</form>
				 <?php  App::Helper('JavaScript')->setAjax(array("debug"=>false,"autoHide"=>false))->appForm('#comment-form');?>
			
		<?php else:?>
			<?php if(!empty($blogpost['data'])):?>
				
				<?php foreach($blogpost['data'] as $post): ?>
					
						<h3><a href="<?php echo $this->baseurl("/blog-by-post/{$post['id']}/" . App::Helper('Utility')->text2Normalize($post['title'])); ?>"><?php echo($post['title']);?></a></h3>
						<p class="post-short-info">
							<?php $catname = App::CategorySet()->idToName($post['category']);?>
							<!--<a href="<?php echo $this->baseurl("/blog-by-cat/{$post['category']}/" . App::Helper('Utility')->text2Normalize($catname)); ?>"><?php echo $catname;?></a> | -->
							Posted by: <strong><?php echo App::Module('adminPanelUi')->adminName($post['adminref']);?></strong> | 
							Posted on: <strong><?php echo App::Helper('Date')->dateFormated($post['entry_date'],'long'); ?></strong> |
							<?php echo App::Model('Comment')->countByPostId($post['id']); echo $this->__(" Comments"); ?>
						</p>
						<?php App::Hook('UI')->Render('blog_before_comment'); #User Interface Hook ?>
						<?php echo($post['description']);?>
						<?php App::Hook('UI')->Render('blog_after_comment'); #User Interface Hook ?>
						<p class="text-right">
							<a href="<?php echo $this->baseurl("/blog-by-post/{$post['id']}/" . App::Helper('Utility')->text2Normalize($post['title'])); ?>">Read More &#8594;</a>
						</p>
					<div class="hr-alt2"></div>
				<?php endforeach;?>
				
				<?php if($blogpost['paging']!=''):?>
					<p><?php echo $blogpost['link']; ?></p>
				<?php endif;?>
			<?php else:?>
				<h2><?php echo $this->__("Sorry! No post submitted yet"); ?></h2>
				<?php App::Hook('UI')->Render('blog_no_comment'); #User Interface Hook ?>
			<?php endif;?>
		<?php endif ?>
		</div>
	</div>
	<div class="clearboth"></div>
</div>